using Godot;

public partial class MainMenu : Control
{
	private VBoxContainer title;
	private HBoxContainer start;
	private Options options;
	private Node settings;

	MainMenu()
	{
		GD.Print("MainMenu...");
	}
	~MainMenu()
	{
		GD.Print("~MainMenu");
	}
	public override void _Ready()
	{
		title = GetNode<VBoxContainer>("TitleScreen");
		start = GetNode<HBoxContainer>("StartGame");
		options = GetNode<Options>("Options");
		settings = GetNode<Node>("/root/Settings");
	}
	private void StartPressed()
	{
		GD.Print("StartPressed");
		start.Visible = true;
		title.Visible = false;
	}
	private void OptionsPressed()
	{
		GD.Print("OptionsPressed");
		options.prevMenu = title;
		options.Visible = true;
		title.Visible = false;
	}

	private void ExitPressed()
	{
		GD.Print("ExitPressed");
		GetTree().Quit();
	}
	private void RandomBlocksPressed()
	{
		settings.Set("world_type", 0);
		GetTree().ChangeSceneToPacked(GD.Load<PackedScene>("res://world/world.tscn"));
	}
	private void FlatGrassPressed()
	{
		settings.Set("world_type", 1);
		GetTree().ChangeSceneToPacked(GD.Load<PackedScene>("res://world/world.tscn"));
	}
	private void BackToTitlePressed()
	{
		title.Visible = true;
		start.Visible = false;
	}
}
